<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form" lay-filter="test1" >
    <input type="hidden" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label required">施工单位：</label>
        <div class="layui-input-block">
            <input type="text" name="maintenanceUnits" lay-verify="required" lay-reqtext="施工单位不能为空" placeholder="请输入施工单位" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">施工负责人：</label>
        <div class="layui-input-block">
            <input type="text" name="maintenanceName" lay-verify="required" lay-reqtext="施工负责人不能为空" placeholder="请输入施工负责人" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">开始日期：</label>
        <div class="layui-input-inline" style="width: 150px;">
            <input type="text" id="date1" name="beginTime" placeholder="请选择开始日期" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid">结束日期：</div>
        <div class="layui-input-inline" style="width: 150px;">
            <input type="text" id="date2" name="finishTime" placeholder="请选择结束日期" autocomplete="off" class="layui-input">
        </div>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">修改信息</button>
        </div>
    </div>
</div>
<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    //获取要修改的对象
    var obj=JSON.parse(localStorage.getItem("user"));
    layui.use(['form','upload','laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            upload = layui.upload,
            laydate = layui.laydate,
            $ = layui.$;
        form.val("test1",obj);
        //渲染日期框
        laydate.render({
            elem: '#date1' //指定元素
        });
        laydate.render({
            elem: '#date2' //指定元素
        });
        // $("#img1")[0].src=obj.avatar;
        form.on('submit(saveBtn)', function (data) {
            //新增用户 Ajax 请求接口
            $.post('/api/msc/update.do',data.field,function (res){
                if(res.code==0){
                    location.href="maintenancestatisticaltable.html"
                }else {
                    layer.msg("亲。修改失败！");
                }
            })
            return false;
        });
    });
</script>
</body>
</html>